define(["ajaxBase", "getPath", "layer"], function (ajaxBase, getPath, layer) {
    return function () {
        let submit = document.querySelector('.submit')
        submit.onclick = (event) => {
            let account = document.querySelectorAll('input')[0].value
            let password = document.querySelectorAll('input')[1].value
            let data = {account, password}
            let method = "POST"
            let url = '/login'
            ajaxBase(data, url, method).then(function (data) {
                if (data.success === true) {
                    window.open(getPath.getRootPathWeb() + '/' + 'index', '_self')
                } else {
                    console.log(layer)
                    layer.msg('密码或账户错误')
                }
            })
        }
    }
})